package com.usian;

import com.usian.pojo.TbUser;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.Map;

@FeignClient("usian-sso-service")
public interface SSOFeign {


    /**
     * 用户注册与登录
     * @param checkValue
     * @param checkFlag
     * @return
     */
    @RequestMapping("/checkUserInfo/{checkValue}/{checkFlag}")
    public Boolean checkUserInfo(@PathVariable String checkValue,
                                @PathVariable Integer checkFlag);



    /**
     * 用户注册
     * @param user
     * @return
     */
    @RequestMapping("/userRegister")
    public Integer userRegister(@RequestBody TbUser user);



    /**
     * 用户登录
     * @param username
     * @param password
     * @return
     */
    @RequestMapping("/userLogin")
    public Map userLogin(@RequestParam String username, @RequestParam String password);



    /**
     * 查询用户是否过期
     * @param token
     * @return
     */
    @RequestMapping("/getUserByToken/{token}")
    public TbUser getUserByToken(@PathVariable String token);



    /**
     * 退出登录
     * @param token
     * @return
     */
    @RequestMapping("/logOut")
    public Boolean logOut(@RequestParam String token);
}
